from django.contrib import admin
from .models import PsychologicalScale, AssessmentRecord


@admin.register(PsychologicalScale)
class PsychologicalScaleAdmin(admin.ModelAdmin):
    """心理量表管理"""
    list_display = ['id', 'scale_name', 'scale_code', 'category', 'total_questions', 'is_active', 'created_at']
    list_filter = ['category', 'is_active', 'created_at']
    search_fields = ['scale_name', 'scale_code', 'description']
    ordering = ['-created_at']


@admin.register(AssessmentRecord)
class AssessmentRecordAdmin(admin.ModelAdmin):
    """测评记录管理"""
    list_display = ['id', 'user', 'scale', 'status', 'total_score', 'result_level', 'start_time', 'complete_time']
    list_filter = ['status', 'result_level', 'start_time']
    search_fields = ['user__username', 'scale__scale_name']
    date_hierarchy = 'start_time'
    ordering = ['-start_time']
